package main

import (
	"fmt"
	"io/ioutil"
	"net/http"
)

func demo1Handler(w http.ResponseWriter, r *http.Request) {
	fmt.Fprintf(w, "name is: %s\n", r.URL.Query()["name"])
}
func demo2Handler(w http.ResponseWriter, r *http.Request) {
	b, _ := ioutil.ReadAll(r.Body)
	fmt.Println(string(b))
	ans := `{"status":"ok"}`
	w.Write([]byte(ans))
}
func main() {

	http.HandleFunc("/demo1", demo1Handler)
	http.HandleFunc("/demo2", demo2Handler)
	http.ListenAndServe(":8080", nil)
}
